The present invention generally relates to computer systems, and more specifically to performing grammar-sensitive editing in a computer system.
As it is known in the art, writing a program such as one written in a computer program language, often requires using complex notation and a program structure particular to the programming language being used. Programming languages include, for example, the "C", Fortran, and COBOL programming languages. Typically, each particular programming language has its own syntax and structure.
Efficiency in developing programs typically decreases if a programmer is unfamiliar with a new programming language, or a particular area of a programming language. For example, when a new program is written in a different programming language unfamiliar to a computer programmer, the computer programmer has an additional task of learning the different programming language and its particular notation and structure.
Even if a programmer is familiar with a programming language, there are typically certain statements or forms of expressions which are infrequently used by a programmer. Thus, program development even for a knowledgeable programmer generally familiar with a programming language can be inefficient and cumbersome with regard to infrequently used features and statements.
Efficiency in program development also suffers once a new programming language is learned, and then infrequently used. The programmer does not typically retain knowledge of the programming language between infrequent program development sessions.
One technique for program development includes using a programming language manual and performing data entry using a keyboard and terminal as with an editor. Such a technique often proves cumbersome and inefficient for program development, particularly for one who infrequently uses a programming language, or is just learning a programming language.
An alternative technique includes an interface to guide the user through the basic programming structure. One such mechanism includes using menus and forms, such as pull down menus with a graphical user interface. Typically, these menus and forms provide static definitions of language elements, such as programming statements. A static menu definition for a programming statement, as typically appearing on a menu or form, does not change throughout the program development. The static nature of menus and forms does not provide for a context sensitive representation of language elements with a large number of possibilities, as during program development when a user dynamically selects one particular language element. In other words, the static menus are unable to dynamically provide assistance in response to a current context, such as a particular statement being entered or selected by a programmer at a particular point in program development. Proper user assistance depends upon the nature of a problem and also the context in which the problem occurs.
Additional difficulties are typically encountered when on-line assistance is required, such as using a menu with on-line help documentation. In this case, the user generally must search through alphabetized lists for help on a particular language feature taking additional time and further decreasing efficiency.
The foregoing techniques do not provide for such feedback and detection of lexical and syntax errors through dynamic interaction with a user for a particular user context. For example, a user typically inputs source code using either of the foregoing techniques producing a source file which is then compiled. The user is not provided with feedback as to syntax errors until the entire source file is entered and compiled. A lexical error generally occurs with an incorrectly formed language element, such as an invalid character in a lexical token (or "token") representing a variable name, language keyword, or other input. As a result of lexical processing, user input is typically represented as tokens. A syntax error generally involves incorrect placement or omission of one lexical token in relation to another lexical token, such as a missing semicolon (";") in a programming language statement.
It should be noted that the problems previously described are not limited to program development, but are generally applicable to a class of problems in which a user is required to have knowledge as to structure and notation of a document or other form, ranging from filling out a tax form to producing an input file for use in a hardware simulation model.
Thus, there is required a new system for editing which provides for increased efficiency and accuracy in a convenient manner, is flexible and applicable in a wide variety of applications, and promotes productivity by error detection and assisting in error correction, assisting in construction of grammatically correct user input, and providing for exploration of alternative formats of user input.